from typing import Dict, List

from bean.FieldInfo import FieldInfo


class TableInfo:

    def __init__(self):
        self.table_name: str = ""
        self.bean_name: str = ""
        self.bean_param_name: str = ""
        self.comment: str = ""

        self.have_date: bool = False
        self.have_date_time: bool = False
        self.have_big_decimal: bool = False

        self.key_index_map: Dict[str, List[FieldInfo]] = {}
        self.field_map: Dict[str, FieldInfo] = {}

        self.extend_fields: List[FieldInfo] = []
        self.increment_lst: List[FieldInfo] = []

        self.__last_field: FieldInfo | None = None

    def get_last_field(self):
        if self.field_map is not {}:
            if self.__last_field is None:
                self.__last_field = list(self.field_map.values())[-1]
            return self.__last_field
        else:
            raise Exception("field_map为空!")
